<template>
  <div>
    <!-- 明细页面 -->
    <!-- tab切换 -->
    <div>
      <!-- <el-steps :active="actived" :space="200" align-center>
        <el-step title="到店" icon="el-icon-success"></el-step>
        <el-step title="试驾" icon="el-icon-success"></el-step>
        <el-step title="订单" icon="el-icon-success"></el-step>
        <el-step title="交车" icon="el-icon-success"></el-step>
        <el-step title="战败" icon="el-icon-success"></el-step>
      </el-steps>-->
      <div class="isSelect">
        <div class="icon_box" v-bind:class="{ icon_color : isShop }">
          <i class="el-icon-success icon_size"></i>
          <div>到店</div>
        </div>
        <div class="line_center line_center1"></div>
        <div class="icon_box" v-bind:class="{ icon_color : isDrive }">
          <i class="el-icon-success icon_size"></i>
          <div>试驾</div>
        </div>
        <div class="line_center line_center2"></div>
        <div class="icon_box" v-bind:class="{ icon_color : isSubscription }">
          <i class="el-icon-success icon_size"></i>
          <div>订单</div>
        </div>
        <div class="line_center line_center3"></div>
        <div class="icon_box" v-bind:class="{ icon_color : isDelivery }">
          <i class="el-icon-success icon_size"></i>
          <div>交车</div>
        </div>
        <div class="line_center line_center4"></div>
        <div class="icon_box" v-bind:class="{ icon_color : isDefeated }">
          <i class="el-icon-success icon_size"></i>
          <div>战败</div>
        </div>
      </div>
    </div>
    <div></div>
    <div>
      <!-- 客档信息 -->
      <FormPanel
        ref="formPanel"
        :list="formList1"
        :cols="3"
        :formType="type"
        labelWidth="90"
        :isSubmitBtn="false"
        @formChange="formChangeHandle"
      />
    </div>
    <!-- 意向车型 -->
    <!-- <BreakSpace label="意向车型" :containerStyle="{ marginBottom: '10px'}"/> -->
    <BreakSpace label="意向车型" />
    <FilterTable
      ref="table"
      :columns="columns1"
      height="auto"
      :dataSource="intentDTOList"
      :isPagination="false"
      :isToperInfo="false"
      :isColumnFilter="false"
      selectionType="single"
      :defaultSelections="selectedList_intentCar"
      :onColumnsChange="columns1 => this.columns1 = columns1"
    ></FilterTable>
    <!-- 联系人 -->
    <BreakSpace label="联系人信息" />
    <FilterTable
      ref="table"
      :columns="columns2"
      height="auto"
      :dataSource="customerContactinfoDTOList"
      :isPagination="false"
      :isToperInfo="false"
      :isColumnFilter="false"
      selectionType="single"
      :defaultSelections="selectedList_customer"
      :onColumnsChange="columns2 => this.columns2 = columns2"
    ></FilterTable>
    <!-- 竞品车型 -->
    <BreakSpace label="竞品车型" />
    <FilterTable
      ref="table"
      :columns="columns3"
      height="auto"
      :dataSource="competitorDTOList"
      :isPagination="false"
      :isToperInfo="false"
      :isColumnFilter="false"
      :isSelectColumn="false"
      selectionType="single"
      :onColumnsChange="columns3 => this.columns3 = columns3"
    ></FilterTable>
    <!-- 保有车辆 -->
    <BreakSpace label="保有车辆" />
    <FilterTable
      ref="tableC"
      :columns="columns4"
      height="auto"
      :dataSource="keepingVehiclesDTOList"
      :isPagination="false"
      :isToperInfo="false"
      :isColumnFilter="false"
      :isSelectColumn="false"
      selectionType="single"
      :onColumnsChange="columns4 => this.columns4 = columns4"
    ></FilterTable>
    <!-- 经销商信息 -->
    <!-- <FormPanel
        ref="formPanel2"
        v-if="form2Show"
        :list="formList2"
        :cols="3"
        :formType="type"
        labelWidth="90"
        :isSubmitBtn="false"
        @formChange="formChangeHandle"
    />-->
    <!-- 更多信息 -->
    <FormPanel
      ref="formPanel3"
      :list="formList3"
      :cols="3"
      :formType="type"
      labelWidth="100"
      :isSubmitBtn="false"
      @formChange="formChangeHandle"
    />
    <!-- 其他信息 -->
    <FormPanel
      ref="formPanel4"
      :list="formList4"
      :cols="3"
      :formType="type"
      labelWidth="80"
      :isSubmitBtn="false"
      @formChange="formChangeHandle"
    />
  </div>
</template>

<script>
import { queryPotenCusManage, getPotenCusById, getCarBuyingFactor, getAllHeatUp } from '@/api/potenCus/customer/potenCusManage';
import { getDataType } from '@/assets/js/auth';
import { dictionary } from '@/utils/dictMixin';
import { formatDates, formatDuring, formatDat } from '@/utils/validate';

export default {
  name: 'cluesInfo',
  mixins: [dictionary],
  props: {
    rowData: {
      type: Object,
      default: () => ({})
    }
  },
  data() {
    this.saveData = null;
    return {
      dataType: getDataType('dataType'),
      intentDTOList: [], //意向车型
      customerContactinfoDTOList: [], //联系人
      competitorDTOList: [], //竞品车型
      keepingVehiclesDTOList: [], //保有车辆
      formList1: this.createFormList1(),
      formList2: this.createFormList2(),
      form2Show: false,
      formList3: this.createFormList3(),
      formList4: this.createFormList4(),
      fetchParams1: {},
      columns1: this.createTableColumns1(),
      fetchParams2: {},
      columns2: this.createTableColumns2(),
      fetchParams3: {},
      columns3: this.createTableColumns3(),
      columns4: this.createTableColumns4(),
      // handleType: '',
      formData: {},
      // conf: { show: '明细' },
      // actived: 2,
      type: 'show',
      isShop: false,
      isDrive: false,
      isSubscription: false,
      isDelivery: false,
      isDefeated: false,
      selectedList_intentCar: [], // 默认选中主车型
      selectedList_customer: [] // 默认选中主联系人
    };
  },
  created() {
    this.init();
    this.isShowData();
    this.getAllHeatUp();
  },
  methods: {
    init() {
      console.log('this.type', this.type);
      console.log('this.rowData21212', this.rowData);
      if (this.type === 'show') {
        // 更新接口需要的记录 ID
        this.potentialCustomersId = this.rowData.customerBusinessId;
        this.clueType = this.rowData.clueType;
        this.ownerCode = this.rowData.ownerCode;
        this.actionStatus = this.rowData.actionStatus;
        this.clueStatus = this.rowData.clueStatus;
        this.getPotenCusList();
        this.getBuyCarList();
        // this.formList1.forEach(x => {
        //   x.initialValue = this.rowData[x.fieldName];
        // });
        //   this.formList1.find(x => x.fieldName ==='contactName').initialValue = this.rowData[x.contactName]
      }
    },
    async getBuyCarList() {
      const res = await getCarBuyingFactor();
      console.log('购车因素', res);
      if (res.resultCode === 200) {
        this.formList3.find(item => item.fieldName === 'buyCarFactorList').itemList = res.data.map(x => ({ value: x.basedataId, text: x.basedataName }));
        // TODO
        this.columns3.find(item => item.dataIndex === 'competitorList').filterItems = res.data.map(x => ({ value: x.basedataId, text: x.basedataName }));
      }
    },
    // selectChangeHandle_intentCar(rows) {
    //   if (!rows.length) return;
    //   this.selectedRow = rows[0];
    // },
    // 客档信息
    createFormList1() {
      return [
        {
          type: 'BREAK_SPACE',
          label: '客户信息',
          style: {}
        },
        {
          type: 'INPUT',
          label: '客户名称',
          fieldName: 'customerName',
          placeholder: ''
        },
        {
          type: 'SELECT',
          label: '客户类型',
          fieldName: 'customerType',
          placeholder: '',
          itemList: this.createDictList('1523')
        },
        {
          type: 'INPUT',
          label: '联系人姓名',
          fieldName: 'contactName',
          placeholder: ''
        },
        {
          type: 'SELECT',
          label: '性别',
          fieldName: 'gender',
          placeholder: '',
          itemList: this.createDictList('1002')
        },
        {
          type: 'INPUT',
          label: '手机号码',
          fieldName: 'mobilePhone',
          placeholder: ''
        },
        {
          type: 'INPUT',
          label: '来源渠道',
          fieldName: 'clueSourceName',
          placeholder: ''
        },
        {
          type: 'INPUT',
          label: '来源备注',
          fieldName: 'clueSourceRemark',
          placeholder: ''
        },
        {
          type: 'SELECT',
          label: '线索热度',
          fieldName: 'temperature',
          placeholder: '',
          itemList: []
        },
        {
          type: 'SELECT',
          label: '意向级别',
          fieldName: 'intentLevel',
          placeholder: '',
          itemList: this.createDictList('1519')
        },
        {
          type: 'DATE',
          label: '预购日期',
          fieldName: 'bookingDate',
          dateType: 'exactdate',
          placeholder: ''
        },
        {
          type: 'SELECT',
          label: '线索类型',
          fieldName: 'clueEnterType',
          placeholder: '',
          itemList: this.createDictList('7019')
        },
        {
          type: 'SELECT',
          label: '订金类型',
          fieldName: 'depositType',
          placeholder: '请选择',
          disabled: this.type === 'addForbase' ? false : true,
          itemList: this.createDictList('8050')
        },
        {
          type: 'INPUT',
          label: '订金金额',
          fieldName: 'depositAmount',
          maxlength: 32,
          placeholder: '请输入'
        },
        {
          type: 'SELECT',
          label: '购买类型',
          fieldName: 'buyType',
          placeholder: '',
          itemList: this.createDictList('7015')
        },
        {
          type: 'SELECT',
          label: '业务分类',
          fieldName: 'businessClassify',
          placeholder: '',
          itemList: this.createDictList('7056')
        },
        {
          type: 'SELECT',
          label: '付款方式',
          fieldName: 'paymentMethod',
          placeholder: '',
          itemList: this.createDictList('1426')
        },
        {
          type: 'SELECT',
          label: '所属顾问',
          fieldName: 'consultantName',
          placeholder: '',
          itemList: []
        },
        {
          type: 'TEXT_AREA',
          label: '备注',
          fieldName: 'remark',
          selfCols: 2,
          rows: 1,
          placeholder: '',
          style: { width: '400px' }
        },
        {
          type: 'MULTIPLE_CHECKBOX',
          label: '商机分析',
          fieldName: 'businessAnaly',
          placeholder: '请选择',
          selfCols: 4,
          itemList: [
            { value: 70431001, text: '邀约进店' },
            { value: 70431002, text: '建立关系' },
            { value: 70431003, text: '需求分析' },
            { value: 70431004, text: '产品介绍' },
            { value: 70431005, text: '试乘试驾' },
            { value: 70431006, text: '异议处理' },
            { value: 70431007, text: '价格商谈' },
            { value: 70431008, text: '定金订单' }
          ]
        }
      ];
    },
    // 经销商信息
    createFormList2() {
      return [
        {
          type: 'BREAK_SPACE',
          label: '经销商信息',
          style: {}
        },
        {
          type: 'SELECT',
          label: '所属区域',
          fieldName: 'orgId',
          placeholder: ''
        },
        {
          type: 'SELECT',
          label: '经销商简称',
          fieldName: 'ownerName',
          placeholder: ''
        },
        {
          type: 'INPUT',
          label: '经销商代码',
          fieldName: 'dealerCode',
          placeholder: '',
          unitRender: () => {
            return <el-button slot="append" icon="el-icon-search" onClick={this.openSearch}></el-button>;
          }
        }
      ];
    },
    // 更多信息
    createFormList3() {
      return [
        {
          type: 'BREAK_SPACE',
          label: '更多信息',
          style: {}
        },
        {
          type: 'INPUT_NUMBER',
          label: '购买车次',
          fieldName: 'buyNum',
          placeholder: ''
        },
        {
          type: 'MULTIPLE_SELECT',
          label: '购车因素',
          fieldName: 'buyCarFactorList',
          placeholder: '',
          itemList: []
        },
        {
          type: 'SELECT',
          label: '购车用途',
          fieldName: 'buyCarUse',
          placeholder: '',
          itemList: this.createDictList('1511')
        },
        {
          type: 'SELECT',
          label: '购车预算',
          fieldName: 'carBudget',
          placeholder: '',
          itemList: this.createDictList('7057')
        },
        {
          type: 'INPUT',
          label: '置换信息',
          fieldName: 'displacementInfo',
          placeholder: ''
        },
        {
          type: 'SELECT',
          label: '了解途径',
          fieldName: 'waysToRoadName',
          placeholder: '',
          itemList: []
        },
        {
          type: 'SELECT',
          label: '证件类型',
          fieldName: 'ctCode',
          placeholder: '',
          itemList: this.createDictList('1508')
        },
        {
          type: 'INPUT',
          label: '证件号码',
          fieldName: 'certificateNo',
          placeholder: ''
        },
        {
          type: 'DATE',
          label: '出生日期',
          fieldName: 'birthday',
          dateType: 'exactdate',
          placeholder: ''
        },
        {
          type: 'SELECT',
          label: '省',
          fieldName: 'provinceName',
          placeholder: '',
          initialValue: '',
          itemList: []
        },
        {
          type: 'SELECT',
          label: '市',
          fieldName: 'cityName',
          placeholder: '',
          initialValue: '',
          itemList: []
        },
        {
          type: 'SELECT',
          label: '区',
          fieldName: 'areaName',
          placeholder: '',
          initialValue: '',
          itemList: []
        },
        {
          type: 'INPUT',
          label: '详细地址',
          selfCols: 2,
          fieldName: 'address',
          placeholder: ''
        },
        {
          type: 'INPUT',
          label: '电子邮箱',
          fieldName: 'eMail',
          placeholder: ''
        },
        {
          type: 'INPUT',
          label: '微信',
          fieldName: 'wechart',
          placeholder: ''
        },
        {
          type: 'INPUT',
          label: 'QQ',
          fieldName: 'qq',
          placeholder: ''
        },
        {
          type: 'INPUT',
          label: '固定电话',
          fieldName: 'phone',
          placeholder: ''
        },
        {
          type: 'SELECT',
          label: '喜欢的联系方式',
          fieldName: 'likeContactWay',
          placeholder: '',
          itemList: this.createDictList('7058')
        },
        {
          type: 'SELECT',
          label: '教育水平',
          fieldName: 'educationalLevel',
          placeholder: '',
          itemList: this.createDictList('7027')
        },
        {
          type: 'SELECT',
          label: '婚姻状况',
          fieldName: 'maritalStatus',
          placeholder: '',
          itemList: this.createDictList('7028')
        },
        {
          type: 'SELECT',
          label: '日常驾乘人数',
          fieldName: 'drivingNumber',
          placeholder: '',
          itemList: this.createDictList('7059')
        },
        {
          type: 'SELECT',
          label: '是否有子女',
          fieldName: 'haveChildren',
          placeholder: '',
          itemList: this.createDictList('1004'),
          change: val => {
            console.log('你有孩子么', val);
            if (val === 10041001) {
              this.formList3.find(x => x.fieldName === 'haveChildren').initialValue = val;
              this.formList3.find(x => x.fieldName === 'childrenNumber').hidden = false;
            } else {
              this.formList3.find(x => x.fieldName === 'haveChildren').initialValue = val;
              this.formList3.find(x => x.fieldName === 'childrenNumber').initialValue = '';
              this.formList3.find(x => x.fieldName === 'childrenNumber').hidden = true;
            }
          }
        },
        {
          type: 'SELECT',
          label: '子女数量',
          fieldName: 'childrenNumber',
          placeholder: '',
          hidden: true,
          itemList: this.createDictList('7060')
        },
        {
          type: 'INPUT_NUMBER',
          label: '家庭人数',
          fieldName: 'familyNum',
          placeholder: ''
        },
        {
          type: 'INPUT_NUMBER',
          label: '家庭年收入(万)',
          fieldName: 'familyInCome',
          placeholder: ''
        },
        {
          type: 'SELECT',
          label: '居住地类型',
          fieldName: 'liveType',
          placeholder: '',
          itemList: this.createDictList('7061')
        },
        {
          type: 'SELECT',
          label: '工作地类型',
          fieldName: 'workPlaceType',
          placeholder: '',
          itemList: this.createDictList('7062')
        },
        {
          type: 'SELECT',
          label: '企业性质',
          fieldName: 'enterpriseType',
          placeholder: '',
          itemList: this.createDictList('7029')
        },
        {
          type: 'SELECT',
          label: '所属行业',
          fieldName: 'industry',
          placeholder: '',
          itemList: this.createDictList('7030')
        },
        {
          type: 'SELECT',
          label: '职业',
          fieldName: 'postName',
          placeholder: '',
          itemList: this.createDictList('7031')
        },
        {
          type: 'SELECT',
          label: '是否吸烟',
          fieldName: 'smokingOrNot',
          placeholder: '',
          itemList: this.createDictList('1004')
        },
        {
          type: 'SELECT',
          label: '个人爱好',
          fieldName: 'avocation',
          placeholder: '',
          itemList: this.createDictList('7032')
        },
        {
          type: 'SELECT',
          label: '钟爱饮料',
          fieldName: 'favoriteDrinks',
          placeholder: '',
          itemList: this.createDictList('7033')
        }
      ];
    },
    // 其他信息
    createFormList4() {
      return [
        {
          type: 'BREAK_SPACE',
          label: '其他信息',
          style: {}
        },
        {
          type: 'INPUT',
          label: '创建人',
          fieldName: 'createdByName',
          placeholder: '',
          disabled: true
        },
        {
          type: 'DATE',
          label: '创建时间',
          fieldName: 'createdAt',
          placeholder: '',
          itemList: []
        },
        {
          type: 'SELECT',
          label: '是否下发',
          fieldName: 'manufacturerIssue',
          placeholder: '',
          itemList: this.createDictList('1004')
        },
        {
          type: 'DATE',
          label: '下发时间',
          fieldName: 'manufacturerIssueDate',
          placeholder: '',
          itemList: []
        },
        // {
        //   type: 'SELECT',
        //   label: '是否清洗',
        //   fieldName: 'sex',
        //   placeholder: '',
        //   itemList: [],
        // },
        // {
        //   type: 'INPUT',
        //   label: '清洗次数',
        //   fieldName: 'sex1',
        //   placeholder: '',
        // },
        {
          type: 'INPUT',
          label: '分配人',
          fieldName: 'distributionConsultantName',
          placeholder: '',
          initialValue: ''
        },
        {
          type: 'INPUT',
          label: '是否进店',
          fieldName: 'shop',
          placeholder: '',
          initialValue: ''
        },
        {
          type: 'INPUT',
          label: '进店类型',
          fieldName: 'shopTime',
          placeholder: ''
        },
        {
          type: 'INPUT',
          label: '进店次数',
          fieldName: 'shopNumber',
          placeholder: ''
        },
        {
          type: 'INPUT',
          label: '是否试驾',
          fieldName: 'testDrive',
          placeholder: ''
        },
        {
          type: 'INPUT',
          label: '是否报价',
          fieldName: 'isPrice',
          placeholder: ''
        },
        {
          type: 'INPUT',
          label: 'cc清洗备注',
          fieldName: 'ccInvalidReason',
          placeholder: ''
        }
      ];
    },
    // 意向车型
    createTableColumns1() {
      return [
        {
          title: '序号',
          dataIndex: 'index',
          width: 50,
          render: props => {
            return <span>{props.row.index + 1}</span>;
          }
        },
        {
          title: '意向品牌',
          dataIndex: 'intentBrandName',
          width: 200,
          filterType: 'input'
        },
        {
          title: '意向车系',
          dataIndex: 'intentSeriesName',
          filterType: 'input'
        },
        {
          title: '意向车型',
          dataIndex: 'intentModelName',
          filterType: 'input'
        },
        {
          title: '意向配置',
          dataIndex: 'intentPackageName',
          filterType: 'input',
          width: 150
        },
        {
          title: '意向选装',
          dataIndex: 'intentOptionName',
          filterType: 'input'
        },
        {
          title: '意向颜色（外饰）',
          dataIndex: 'intentColorName',
          filterType: 'input'
        },
        {
          title: '意向颜色（内饰）',
          dataIndex: 'interiorName',
          filterType: 'input'
        },
        {
          title: '购买备注',
          dataIndex: 'remark',
          filterType: 'input'
        }
      ];
    },
    // 备用联系人
    createTableColumns2() {
      return [
        {
          title: '序号',
          dataIndex: 'index',
          width: 50,
          render: props => {
            return <span>{props.row.index + 1}</span>;
          }
        },
        {
          title: '联系人姓名',
          dataIndex: 'contactName',
          filterType: 'input'
        },
        {
          title: '性别',
          dataIndex: 'gender',
          filterType: 'checkbox',
          filterItems: this.createDictList('1002'),
          render: props => {
            return <span>{this.createDictText(props.row.gender, '1002')}</span>;
          }
        },
        {
          title: '联系人手机',
          dataIndex: 'contactorPhone',
          filterType: 'input'
        },
        {
          title: '联系人类型',
          dataIndex: 'contactType',
          filterType: 'checkbox',
          filterItems: this.createDictList('7034'),
          render: props => {
            return <span>{this.createDictText(props.row.contactType, '7034')}</span>;
          }
        },
        {
          title: '关系',
          dataIndex: 'contactRelation',
          filterType: 'checkbox',
          filterItems: this.createDictList('1534'),
          render: props => {
            return <span>{this.createDictText(props.row.contactRelation, '1534')}</span>;
          }
        },
        {
          title: '备注',
          dataIndex: 'contactRemark',
          filterType: 'input'
        }
      ];
    },
    // 竞品车型
    createTableColumns3() {
      return [
        {
          title: '序号',
          dataIndex: 'index',
          width: 50,
          render: props => {
            return <span>{props.row.index + 1}</span>;
          }
        },
        {
          title: '竞争品牌',
          dataIndex: 'failBrand',
          filterType: 'input'
        },
        {
          title: '竞争车型',
          dataIndex: 'failSeries',
          filterType: 'input'
        },
        {
          title: '竞品关注点',
          dataIndex: 'competitorList',
          initialValue: '',
          filterType: 'input'
        },
        {
          title: '备注',
          dataIndex: 'competitorRemark',
          filterType: 'input'
        }
      ];
    },
    // 保有
    createTableColumns4() {
      return [
        {
          title: '序号',
          dataIndex: 'index',
          width: 50,
          sorter: true,
          render: props => {
            return <span>{props.row.index + 1}</span>;
          }
        },
        {
          title: '品牌',
          dataIndex: 'keepVehiclesBrand',
          filterType: 'input',
          filterItems: []
        },
        {
          title: '车系',
          dataIndex: 'keepVehiclesSeries',
          filterType: 'input',
          filterItems: []
        },
        {
          title: '车型',
          dataIndex: 'keepVehiclesModel',
          filterType: 'input',
          filterItems: []
        },
        {
          title: 'VIN',
          dataIndex: 'vin',
          width: 180,
          filterType: 'input'
        },
        {
          title: '购买日期',
          dataIndex: 'buyDate',
          dateType: 'exactdate',
          width: 160,
          initialValue: '',
          filterType: 'input',
          render: props => {
            return <span>{formatDat(props.row.buyDate)}</span>;
          }
        },
        {
          title: '购买车龄(天)',
          dataIndex: 'boughtCarsAge',
          filterType: 'input',
          render: props => {
            return <span>{props.row.boughtCarsAge}</span>;
          }
        },
        {
          title: '行驶里程(km)',
          dataIndex: 'drivingMileage',
          filterType: 'input'
        },
        {
          title: '备注',
          dataIndex: 'keepingRemark',
          filterType: 'input'
        }
      ];
    },
    formChangeHandle(val) {
      this.saveData = val;
    },
    isShowData() {
      const dataType = getDataType('dataType');
      // console.log('dataType', dataType)
      if (this.dataType != 10461001) {
        this.form2Show = true;
      } else {
        this.form2Show = false;
      }
    },
    // 获取编辑明细
    async getPotenCusList() {
      // TODO:
      const res = await getPotenCusById(this.potentialCustomersId, this.clueType, this.ownerCode);
      // const res = await getPotenCusById(this.potentialCustomersId, this.clueType);
      console.log('线索明细', res);
      // console.log('接触状态', res.data.shop, res.data.testDrive, res.data.subscription, res.data.delivery, res.data.defeated);
      if (res.resultCode === 200) {
        // 显示客档的当前状态
        if (res.data.shop == true) {
          this.isShop = true;
        }
        if (res.data.testDrive == true) {
          this.isDrive = true;
        }
        if (res.data.subscription == true) {
          this.isSubscription = true;
        }
        if (res.data.delivery == true) {
          this.isDelivery = true;
        }
        if (res.data.defeated == true) {
          this.isDefeated = true;
        }
        this.formList1.forEach(x => {
          x.initialValue = res.data[x.fieldName];
          x.fieldName === 'businessAnaly' && res.data['businessAnaly'] ? (x.initialValue = res.data['businessAnaly'].split(',').map(x => parseInt(x))) : [];
        });
        // this.formList1.find(x => x.fieldName === 'clueSourceName').initialValue = res.data.clueSourceName;
        this.formList1.find(x => x.fieldName === 'bookingDate').initialValue = formatDates(res.data.bookingDate);
        this.formList1.find(x => x.fieldName === 'consultantName').initialValue = res.data.currentConsultantName;

        console.log('编辑的客户类型', res.data.customerType);
        if (res.data.customerType === 15231001) {
          this.formList1.find(item => item.fieldName === 'contactName').hidden = true;
          this.formList1.find(item => item.fieldName === 'gender').label = '性别';
          this.formList1.find(item => item.fieldName === 'mobilePhone').label = '手机号码';
        }
        if (res.data.customerType === 15231003) {
          // this.contactName == this.formList1.find(item => item.fieldName ==='customerName').initialValue
          this.formList1.find(item => item.fieldName === 'contactName').hidden = false;
          this.formList1.find(item => item.fieldName === 'contactName').initialValue = res.data.contactName;
          this.formList1.find(item => item.fieldName === 'gender').label = '联系人性别';
          this.formList1.find(item => item.fieldName === 'mobilePhone').label = '联系人手机';
        }

        this.formList3.forEach(x => {
          x.initialValue = res.data[x.fieldName];
        });
        this.formList3.find(x => x.fieldName === 'buyCarFactorList').initialValue = [];
        // 是否有子女
        if (res.data.haveChildren === 10041001) {
          this.formList3.find(x => x.fieldName === 'haveChildren').initialValue = res.data.haveChildren;
          this.formList3.find(x => x.fieldName === 'childrenNumber').hidden = false;
          this.formList3.find(x => x.fieldName === 'childrenNumber').initialValue = res.data.childrenNumber;
        } else if (res.data.haveChildren === 10041002) {
          this.formList3.find(x => x.fieldName === 'haveChildren').initialValue = res.data.haveChildren;
          this.formList3.find(x => x.fieldName === 'childrenNumber').hidden = true;
        }
        res.data.buyCarFactorList.map(x => {
          // console.log(x,"购车因素")
          this.formList3.find(x => x.fieldName === 'buyCarFactorList').initialValue.push(x.basedataId);
        });
        this.formList3.find(x => x.fieldName === 'birthday').initialValue = formatDates(res.data.birthday);
        this.formList4.forEach(x => {
          x.initialValue = res.data[x.fieldName];
        });
        this.formList4.find(x => x.fieldName === 'createdAt').initialValue = formatDates(res.data.createdAt);
        this.formList4.find(x => x.fieldName === 'manufacturerIssueDate').initialValue = formatDates(res.data.manufacturerIssueDate);
        this.formList4.find(x => x.fieldName === 'shop').initialValue = this.formList4.find(x => x.fieldName === 'shop').initialValue ? '是' : '否';
        this.formList4.find(x => x.fieldName === 'testDrive').initialValue = this.formList4.find(x => x.fieldName === 'testDrive').initialValue ? '是' : '否';
        this.formList4.find(x => x.fieldName === 'isPrice').initialValue = this.formList4.find(x => x.fieldName === 'isPrice').initialValue ? '是' : '否';
        this.formList4.find(x => x.fieldName === 'ccInvalidReason').initialValue = this.rowData.ccInvalidReason;
        // 意向
        if (res.data.clueIntentDTOList.length) {
          let carList = [];
          this.intentDTOList = res.data.clueIntentDTOList;
          this.intentDTOList.forEach(item => {
            item['intentBrand'] = item.intentBrandId;
            item['intentSeries'] = item.intentSeriesId;
            item['intentModel'] = item.intentModelId;
            item['intentPackage'] = item.intentPackageId;
            item['intentColor'] = item.intentColorId;
            if (item.isMainIntent === 10041001) {
              carList.push(item);
              this.selectedList_intentCar = carList;
            }
          });
        }
        // 联系人
        if (res.data.customerContactinfoDTO.length) {
          this.customerContactinfoDTOList = res.data.customerContactinfoDTO;
          this.customerContactinfoDTOList.forEach(item => {
            let customerList = [];
            if (item.isMain === 10041001) {
              customerList.push(item);
              this.selectedList_customer = customerList;
            }
          });
          // this.formList1.find(x => x.fieldName === 'contactName').initialValue = res.data.customerContactinfoDTO[0].contactName;
        }
        // console.log('竞品列表',res.data.competitors)
        // 竞品
        if (res.data.competitors.length) {
          this.competitorDTOList = res.data.competitors;
          this.competitorDTOList.forEach(item => {
            let name = '';
            item['failBrand'] = item.failBrand;
            item['failSeries'] = item.failSeries;
            if (item.competitorList) {
              item.competitorList.forEach(item => {
                name += item.basedataName + ',';
              });
            }
            // console.log('name ',name)
            item['competitorList'] = name;
          });
        }
        // 保有
        if (res.data.keepingVehiclesDTO.length) {
          this.keepingVehiclesDTOList = res.data.keepingVehiclesDTO;
        }
      }
    },
    async getAllHeatUp() {
      const res = await getAllHeatUp({ isValid: 10041001 });
      console.log('客档热度定义', res);
      if (res.resultCode === 200) {
        this.formList1.find(item => item.fieldName === 'temperature').itemList = res.data.map(x => ({ value: x.id, text: x.clueHeatName }));
      }
    },
    async openSearch() {
      // this.handleType = '点击搜索经销商代码';
      alert('点击搜索经销商代码');
    },
    closeDialog(param) {
      this.$emit('close', false, param);
    }
  }
};
</script>

<style lang="less" scoped>
@color: #7491f1;
.information {
  position: relative;
  .info {
    position: absolute;
    top: -10px;
    left: 13px;
  }
  .line {
    width: 6px;
    height: 20px;
    background: #1890ff;
    position: absolute;
    top: -10px;
    left: 0;
  }
  .el-divider--horizontal {
    display: block;
    height: 1px;
    width: 90.5%;
    margin: 20px 0 12px 92px;
  }
}
.isSelect {
  width: 100%;
  height: 60px;
  position: relative;

  .icon_box {
    float: left;
    width: 20%;
    text-align: center;

    .icon_size {
      font-size: 28px;
      line-height: 42px;
    }
  }
  .icon_color {
    color: #53abfe;
  }
  .line_center {
    width: 124px;
    height: 3px;
    background: #ccc;
    position: absolute;
    top: 19px;
  }
  .line_center1 {
    left: 145px;
  }
  .line_center2 {
    left: 360px;
  }
  .line_center3 {
    right: 360px;
  }
  .line_center4 {
    right: 145px;
  }
}
</style>

